using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class AreaMap : EntityTypeConfiguration<Area>
	{
		public AreaMap()
		{
			// Primary Key
			this.HasKey(t => t.AreaID);

			// Properties
			this.Property(t => t.AreaID)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.AreaName)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.CityID)
				.IsRequired()
				.HasMaxLength(10);
				
			this.Property(t => t.PostCode)
				.HasMaxLength(10);
				
			this.Property(t => t.ZoneCode)
				.HasMaxLength(10);
				
			// Table & Column Mappings
			this.ToTable("Area");
			this.Property(t => t.AreaID).HasColumnName("AreaID");
			this.Property(t => t.AreaName).HasColumnName("AreaName");
			this.Property(t => t.CityID).HasColumnName("CityID");
			this.Property(t => t.PostCode).HasColumnName("PostCode");
			this.Property(t => t.ZoneCode).HasColumnName("ZoneCode");
			this.Property(t => t.TransferFee).HasColumnName("TransferFee");
			this.Property(t => t.Sorting).HasColumnName("Sorting");
			this.Property(t => t.IsDeleted).HasColumnName("IsDeleted");
			this.Property(t => t.CreatBy).HasColumnName("CreatBy");
			this.Property(t => t.CreatTime).HasColumnName("CreatTime");
			this.Property(t => t.CreatStation).HasColumnName("CreatStation");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.UpdateStation).HasColumnName("UpdateStation");
			this.Property(t => t.GisStatus).HasColumnName("GisStatus");
		}
	}
}

